<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org">
<head>
  <th:block th:include="include :: header('办理结果审核')"/>
  <!--<th:block th:include="include :: select2-css" />-->
  <link th:href="@{/ajax/libs/bootstrap-switch/bootstrap-switch.min.css}" rel="stylesheet">
  <link th:href="@{/ajax/libs/bootstrap-tagsinput/tagsinput.css}" rel="stylesheet">
  <link th:href="@{/ajax/libs/jQuery-ui/jquery-ui.css}" rel="stylesheet">
  <link th:href="@{/css/iconfont/iconfont.css}" rel="stylesheet">
  <link th:href="@{/css/style.css}" rel="stylesheet">
  <link rel="stylesheet" type="text/css" th:href="@{/ajax/libs/qxEasyUI/themes/default/easyui.css}">

  <style>
    label {
      font-weight: bold;
    }

    @font-face {
      font-family: 'huawen';
      src: url("/fonts/huawen.woff2");
    }
  </style>
</head>
<style>
  .bootstrap-tagsinput > input {
    display: none;
  }
  label {
    font-weight: bold;
  }

  @font-face {
    font-family: 'huawen';
    src: url("/fonts/huawen.woff2");
  }
  .add-wfTag {
    color: #fff;
    background-color: #3e94c3;
    border-color: #12a1d5;
  }
  .commonTag {
    margin: 5px;
    cursor: pointer;
  }
</style>

<body style="background-color: #F4F6FA;font-size: 13px;font-family:'huawen' ;font-weight: bold">
<div class="main-content" style="margin: 0;padding: 0">

  <form id="form-user-add" th:object="${workFormBase}" class="form-horizontal" style="background-color: #F4F6FA">
    <input type="hidden" name="pkId" th:value="${sendBackEty.pkId}">
    <input type="hidden" name="wfId" id="wfId" th:value="${workFormBase.pkId}">
    <input type="hidden" name="originFK" id="originFK" th:value="${workFormBase.originFK}">
    <input type="hidden" name="sortName" th:value="${sendBackEty.sortName}">
    <input type="hidden" name="sbdeptName" th:value="${sendBackEty.sbdeptName}">
    <input type="hidden" id="userRole" th:value="${userRole}">
    <div class="col-sm-12" style="display: flex;justify-content: center">
      <div class="col-sm-12 entering-page" style="width: 100%;">
        <!--工单基本信息-->
        <div class="col-sm-12">
          <div class="col-sm-12" style="display: flex;justify-content: space-between">
            <div class="tltieBoder">
              <div class="blueBorder"></div>
              <h4 style="margin:0 0 0 10px">工单基本信息</h4>&nbsp;<button class="btn btn-sm btn-primary" onclick="lookWorkNo()">查看详情</button>
              <div style="margin-left: 20px;">
                <button type="button" class="btn btn-sm add-wfTag" onclick="makeTag()">打标签
                </button>
              </div>
            </div>
          </div>
          <!--该工单标签-->
          <div class="col-sm-12">
            <div class="form-group col-sm-12">
              <label class="col-sm-3 control-label entering-pd" style="margin-left: -15px;">该工单标签</label>
              <div class="col-sm-9 card card-body">
                <th:block th:if="${wfTag} != null" th:each="item : ${wfTag}">
                  <span class="badge badge-pill badge-light commonTag" th:title="${item['tagName']}" th:value="${item['tagNo']}">[[${item['tagName']}]]</span>
                </th:block>
              </div>
            </div>
          </div>
          <!--工单编号、工单性质-->
          <div class="form-group col-sm-12">
            <!--工单编号-->
            <label class="col-sm-3 control-label entering-pd">工单编号：</label>
            <div class="col-sm-1">
              <span class="tworkformprocess-span" >[[*{workFormNo}]]</span>
            </div>
            <!--工单性质-->
            <label class="col-sm-3 control-label entering-pd">工单性质：</label>
            <div class="col-sm-1">
              <span class="tworkformprocess-span">[[*{setProName}]]</span>
            </div>
          </div>
          <!--工单主题-->
          <div class="form-group col-sm-12">
            <label class="col-sm-3 control-label entering-pd">工单主题：</label>
            <div class="col-sm-9">
              <span class="tworkformprocess-span">[[*{fromTopic}]]</span>
            </div>
          </div>
          <!--交办次序、办理时限-->
          <div class="form-group col-sm-12">
            <label class="col-sm-3 control-label entering-pd">交办次序：</label>
            <div class="col-sm-1">
              <span class="tworkformprocess-span">[[${sendBackEty.seqName}]]</span>
            </div>
            <label class="col-sm-3 control-label entering-pd">办理时限：</label>
            <div class="col-sm-3">
              <span class="tworkformprocess-span">[[${#dates.format(sendBackEty.backLimit,'yyyy-MM-dd HH:mm:ss')}]]</span>
            </div>
          </div>
          <!--承办单位-->
          <div class="form-group col-sm-12">
            <label class="col-sm-3 control-label  entering-pd">承办单位：</label>
            <div class="col-sm-6">
              <span class="tworkformprocess-span">[[${sendBackEty.sbdeptName}]]</span>
            </div>
          </div>
          <!--办理性质、回复时间-->
          <div class="form-group col-sm-12">
            <label class="col-sm-3 control-label entering-pd">办理性质：</label>
            <div class="col-sm-1">
              <span class="tworkformprocess-span">[[${sendBackEty.sortName}]]</span>
            </div>
            <label class="col-sm-3 control-label entering-pd">回复时间：</label>
            <div class="col-sm-3">
              <span class="tworkformprocess-span">[[${#dates.format(sendBackEty.backTime,'yyyy-MM-dd HH:mm:ss')}]]</span>
            </div>
          </div>
          <!--责任部门、联系电话-->
          <div class="form-group col-sm-12">
            <label class="col-sm-3 control-label entering-pd">责任部门：</label>
            <div class="col-sm-1">
              <span class="tworkformprocess-span">[[${sendBackEty.bdutyDept}]]</span>
            </div>
            <label class="col-sm-3 control-label entering-pd">联系电话：</label>
            <div class="col-sm-1">
              <span class="tworkformprocess-span">[[${sendBackEty.bdutyTel}]]</span>
            </div>
          </div>
          <!--来信内容-->
<!--          <div class="form-group col-sm-12">-->
<!--            <label class="col-xs-3 control-label entering-pd">来信内容：</label>-->
<!--            <div class="col-xs-9">-->
<!--                                    <textarea th:text="*{fmContent}" maxlength="3500"-->
<!--                                              class="form-control workRemark"-->
<!--                                              rows="3" style="height: 100px"></textarea>-->
<!--            </div>-->
<!--          </div>-->
          <!-- 回复内容-->
          <div class="form-group col-sm-12">
            <label class="col-xs-3 control-label entering-pd">回复内容：</label>
            <div class="col-xs-9">
                                    <textarea th:text="${sendBackEty.backDesc}" maxlength="3500"
                                              class="form-control workRemark"
                                              rows="3" style="height: 100px"></textarea>
            </div>
          </div>
          <!-- 工单备注-->
          <div class="form-group col-sm-12">
            <label class="col-xs-3 control-label entering-pd">备注：</label>
            <div class="col-xs-9">
                                    <textarea th:text="${sendBackEty.backRemark}" maxlength="3500"
                                              class="form-control workRemark"
                                              rows="3" style="height: 80px"></textarea>
            </div>
          </div>
        </div>
        <!--审查结论-->
        <div class="col-sm-12">
          <div class="col-sm-12 tltieBoder">
            <div class="blueBorder"></div>
            <h4 style="margin:0 0 0 10px">审查结论</h4>
          </div>
          <div class="form-group col-sm-12">
            <label class="col-sm-3  control-label entering-pd" style="color: red">审查意见&nbsp;&nbsp;：</label>
            <div class="col-sm-6">
              <input type="hidden" name="backState" id="backState"/>
              <input type="text" name="opinion" id="sendRemark" th:value="${sendBackEty.sendRemark}" class="form-control workTheme"
                     data-size="small"/>
            </div>
          </div>
          <div class="form-group col-sm-12">
            <label class="col-sm-3 control-label entering-pd" style="color: red">不通过理由&nbsp;&nbsp;：</label>
            <div class="col-sm-6">
              <input id="reason" name="reason" type="text" class="form-control workTheme"
                     data-size="small">
            </div>
          </div>
          <!--按钮-->
          <div class="col-sm-12 entering-bt pb10" style="justify-content: center;margin: 10px 0 10px 0;">
            <button type="button" class="btn btn-sm btn-info" onclick="passOrNoPass('同意',21)">通过
            </button>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
            <button type="button" class="btn btn-sm btn-info" th:if="${pSendBackEty!=null}" onclick="passOrReply()" style="margin-right: 25px;">通过并再回
            </button>
            <button type="button" class="btn btn-sm btn-success" onclick="passOrNoPass('不同意',22)">不通过
            </button>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
            <button type="button" class="btn btn-sm btn-warning" onclick="closeItem()">关闭
            </button>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
          </div>
        </div>
      </div>
    </div>

  </form>
</div>

<script th:src="@{/ajax/libs/layui/laydate.js}"></script>
<th:block th:include="include :: footer"/>
<!--<th:block th:include="include :: select2-js" />-->
<script th:src="@{/ajax/libs/bootstrap-tagsinput/tagsinput.min.js}"></script>
<script th:src="@{/ajax/libs/bootstrap-switch/bootstrap-switch.min.js}"></script>
<script th:src="@{/ajax/libs/jQuery-ui/jquery-ui.js}"></script>
<script th:src="@{/ajax/libs/qxEasyUI/jquery.easyui.min.js}"></script>
<script th:src="@{/js/telsendorder.js}"></script>
<script th:src="@{/js/teladd.js}"></script>

<script>
  var prefix = "/system/mMailWF";

  function passOrNoPass(sendRemark, backState) {
    $('#sendRemark').val(sendRemark);
    $('#backState').val(backState);
    if ($('#sendRemark').val() === '不同意') {
      if ($('#reason').val().trim() === '') {
        $.modal.msgWarning('不通过理由不能为空！');
        return
      }
      $("#backState").val(22);
    } else {
      $("#backState").val(21);
    }
    let data = $('#form-user-add').serializeArray();
    $.operate.saveTab(prefix + "/cmnFile/sendBackChk", data,refreshMListSonOver);
  }


  $('#dfmClaNo').change(function () {
    var dfmClaName = $("#dfmClaNo option:selected").text();
    var txtDCntAName = $("#txtDCntAName").val();
    var fromName = $("#fromName").val();
    $("#wsTopic").val(fromName + '[' + dfmClaName + ']' + txtDCntAName);
  })

  //查看详情
  function lookWorkNo(){
    var idWF=$("#wfId").val();
    // var url = 'system/lookup/mailOrderDetail/' + idWF;
    // $.modal.open('信件工单-详情',url,'85%','95%');
    parent.layer.open({
      type: 2,
      area: ['90%','90%'],
      title: '信件工单详情',
      content:'/system/lookup/mailOrderDetail/'+idWF,
      shadeClose: true
    });
  }

  // 添加工单标签
  function makeTag(){
    var mailId = $("[name='originFK']").val();
    var url = ctx+"system/tag/addMailWFTag?mailId=" + mailId;
    var title = "添加工单标签";
    $.modal.open(title,url, '800', '500',callback);
  }

  // 刷新当前页面
  function callback(index, layero){
    var iframeWin = layero.find('iframe')[0];
    iframeWin.contentWindow.submitHandler();
  }

  function passOrReply(){
    var btn = ['<i class="fa fa-close"></i> 关闭'];
    var sbId = $("[name='pkId']").val();
    var wfId = $("#wfId").val();
    var url = prefix + "/cmnFile/passOrReply?sbId="+sbId+"&wfId="+wfId;
    var options = {
      title: '通过并再回',
      width: "1200",
      height: "500",
      url: url,
      btn: btn,
      skin: 'layui-layer-gray',
      yes: function (index, layero) {
        $.modal.close(index);
      }
    };
    $.modal.openOptions(options);
  }

  // 刷新下级已办毕-待处理列表
  function refreshMListSonOver() {
    var navFrame = $('.NAP_iframe[data-id="/system/cmnTab/mListSonOverTab"]', parent.document).contents().find('#navFrame')[0];
    navFrame.contentWindow.$.table.refresh();
  }
</script>
</body>
</html>

